package behaviors;

import math.vector.vec3f;

public class Position
{
    
    private vec3f pos;
    //<editor-fold defaultstate="collapsed" desc="getPos">
    public vec3f getPos()
    {
        return this.pos;
    }
    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="setPos">
    public void setPos(float px, float py, float pz)
    {
        this.pos.setTo(px, py, pz);
    }
    
    public void setPos(vec3f position)
    {
        this.pos.setTo(position);
    }
    //</editor-fold>
    
    private vec3f posStart;
    //<editor-fold defaultstate="collapsed" desc="getPosStart">
    public vec3f getPosStart()
    {
        return this.posStart;
    }
    //</editor-fold>
    //<editor-fold defaultstate="collapsed" desc="setStart">
    public void setStart(float sx, float sy, float sz)
    {
        this.posStart = new vec3f(sx, sy, sz);
        this.resetToStart();
    }
    
    public void setStart(vec3f startPos)
    {
        this.setStart(startPos.x, startPos.y, startPos.z);
    }
    //</editor-fold>
    
    public Position() 
    {
        this.pos = new vec3f();
        this.posStart = new vec3f();
    }
    
    //<editor-fold defaultstate="collapsed" desc="translate[Add/Sub]">
    public void translateAdd(float dX, float dY, float dZ)
    {
        this.pos.translate(dX, dY, dZ);
    }
    
    public void translateAdd(vec3f delta)
    {
        this.translateAdd(delta.x, delta.y, delta.z);
    }
    
    public void translateSub(float dX, float dY, float dZ)
    {
        this.pos.translate(-dX, -dY, -dZ);
    }
    
    public void translateSub(vec3f delta)
    {
        this.translateSub(delta.x, delta.y, delta.z);
    }
    //</editor-fold>
    
    public void resetToStart() 
    {
        this.pos.setTo(this.posStart);
    }
    
    public String toString() 
    {
        String s = "";
        s += "POSITION BEHAVIOR: ";
        s += "\n   " + this.pos;
        return s;
    }

    public void destroy()
    {
        this.pos = null;
        this.posStart = null;
    }
    
}
